<div class="content_filtro">
    <div class="filtro">
        <form id="form_filtro" method="post" action="">
            <i>Pesquisar</i>
            
            <input type="text" id="filtro_nm" name="filtro_nm" placeholder="Aluno" value="<?php echo $this->filtro_nm?>" />
            
            &nbsp;
            
            <input type="submit" value="buscar" name="buscar" class="btn-pdr">
            
        </form>
    </div>
</div>

<a href="<?php echo $this->url(array('controller' => 'listaaprovacao', 'action' => 'index', 'id' => '')); ?>">Voltar para Lista de Aprovados</a>
<br><br>
<div class="content-list">
    
    <h2><?php echo $this->titulo;?></h2>
    <br>
    
    <ul class="list-alunos">
    <?php 
        foreach($this->result as $row){ 
       
        $img = ''; 
        $imgs = 'public/upload/aluno/'.$row['ALU_ID'].'_tmb.*';
        foreach (glob($imgs) as $src) {
            $img = $src;
        }
        if(strlen($img) < 5){
            $img = 'public/media/images/aluno.png'; 
        }
        
        $query = 'SELECT SQL_CACHE m.MAT_ID, c.CUR_ID '
            .' FROM MATRICULA m, CURSO c '
            .' WHERE m.CUR_ID = c.CUR_ID AND m.ALU_ID = ' . $row['ALU_ID']
            .' AND c.CUR_STA = 1 AND m.MAT_STA = 1'
            .' ORDER BY m.MAT_DAT DESC';
        $mat = $this->db->fetchRow($query);
        if(!isset($mat['CUR_ID'])){
            $query = 'SELECT SQL_CACHE m.MAT_ID, c.CUR_ID '
                .' FROM MATRICULA m, CURSO c '
                .' WHERE m.CUR_ID = c.CUR_ID AND m.ALU_ID = ' . $row['ALU_ID']
                .' AND c.CUR_ANO = "'.$row['LAP_ANO'].'"'
                .' ORDER BY m.MAT_DAT DESC';
            $mat = $this->db->fetchRow($query);
        }
        
    ?>  
        <li>
            <div class="content-foto"><img src="<?php echo '/'.$img; ?>" /></div>
            <div class="row"><strong><?php echo $row['ALU_NOM'].' - '.$row['ALU_ID']; ?></strong></div>
            <div class="row"><strong></strong> <?php echo dominio::getTurma($mat['CUR_ID'],0); ?></div>
            <div class="row rwu"><?php echo substr($row['FAC_NOM'].' '.$row['CUF_NOM'],0,40); ?></div>
            <div class="content-btn">
                <?php if($this->per_edt){?><a class="btn-pdr" target="_blank" href="<?php echo $this->url(array('controller' => 'aluno', 'action' => 'edit', 'id' => $row['ALU_ID'])); ?>">Cadastro</a><?php } ?>
            </div>
        </li>
    <?php  } ?>
    </ul>
    
    <?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
    
</div>